|
bldcfoc2 2.2.0
|
API for configuring and manipulating BLDC FOC 2 Click driver. More...
Topics | |
| BLDC FOC 2 Registers List | |
| List of registers of BLDC FOC 2 Click driver. | |
| BLDC FOC 2 Registers Settings | |
| Settings for registers of BLDC FOC 2 Click driver. | |
| BLDC FOC 2 MikroBUS Map | |
| MikroBUS pin mapping of BLDC FOC 2 Click driver. | |
Functions | |
| void | bldcfoc2_cfg_setup (bldcfoc2_cfg_t *cfg) |
| BLDC FOC 2 configuration object setup function. | |
| err_t | bldcfoc2_init (bldcfoc2_t *ctx, bldcfoc2_cfg_t *cfg) |
| BLDC FOC 2 initialization function. | |
| err_t | bldcfoc2_default_cfg (bldcfoc2_t *ctx) |
| BLDC FOC 2 default configuration function. | |
| err_t | bldcfoc2_write_reg (bldcfoc2_t *ctx, uint8_t reg, uint32_t data_in) |
| BLDC FOC 2 write register function. | |
| err_t | bldcfoc2_read_reg (bldcfoc2_t *ctx, uint8_t reg, uint32_t *data_out) |
| BLDC FOC 2 read register function. | |
| err_t | bldcfoc2_read_regs (bldcfoc2_t *ctx, uint8_t reg, uint32_t *data_out, uint8_t len) |
| BLDC FOC 2 read multiple registers function. | |
| err_t | bldcfoc2_set_duty_cycle (bldcfoc2_t *ctx, float duty_cycle) |
| BLDC FOC 2 set duty cycle function. | |
| err_t | bldcfoc2_pwm_stop (bldcfoc2_t *ctx) |
| BLDC FOC 2 stop PWM function. | |
| err_t | bldcfoc2_pwm_start (bldcfoc2_t *ctx) |
| BLDC FOC 2 start PWM function. | |
| void | bldcfoc2_pull_brake (bldcfoc2_t *ctx) |
| BLDC FOC 2 pull brake function. | |
| void | bldcfoc2_release_brake (bldcfoc2_t *ctx) |
| BLDC FOC 2 release brake function. | |
| void | bldcfoc2_set_direction (bldcfoc2_t *ctx, uint8_t dir) |
| BLDC FOC 2 set direction function. | |
| void | bldcfoc2_switch_direction (bldcfoc2_t *ctx) |
| BLDC FOC 2 switch direction function. | |
| uint8_t | bldcfoc2_get_fgo_pin (bldcfoc2_t *ctx) |
| BLDC FOC 2 get FGO pin state function. | |
| uint8_t | bldcfoc2_get_fault_pin (bldcfoc2_t *ctx) |
| BLDC FOC 2 get FAULT pin state function. | |
| err_t | bldcfoc2_eeprom_access_lock (bldcfoc2_t *ctx) |
| BLDC FOC 2 EEPROM access lock function. | |
| err_t | bldcfoc2_eeprom_access_unlock (bldcfoc2_t *ctx) |
| BLDC FOC 2 EEPROM access unlock function. | |
| err_t | bldcfoc2_eeprom_erase (bldcfoc2_t *ctx, uint8_t addr) |
| BLDC FOC 2 EEPROM erase function. | |
| err_t | bldcfoc2_eeprom_write (bldcfoc2_t *ctx, uint8_t addr, uint32_t data_in) |
| BLDC FOC 2 EEPROM write function. | |
| err_t | bldcfoc2_eeprom_read (bldcfoc2_t *ctx, uint8_t addr, uint32_t *data_out) |
| BLDC FOC 2 EEPROM read function. | |
| err_t | bldcfoc2_eeprom_set_config (bldcfoc2_t *ctx) |
| BLDC FOC 2 EEPROM default config function. | |
API for configuring and manipulating BLDC FOC 2 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
| void bldcfoc2_cfg_setup | ( | bldcfoc2_cfg_t * | cfg | ) |
BLDC FOC 2 configuration object setup function.
This function initializes Click configuration structure to initial values.
| [out] | cfg | : Click configuration structure. See bldcfoc2_cfg_t object definition for detailed explanation. |
| err_t bldcfoc2_default_cfg | ( | bldcfoc2_t * | ctx | ) |
BLDC FOC 2 default configuration function.
This function executes a default configuration of BLDC FOC 2 Click board.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t bldcfoc2_eeprom_access_lock | ( | bldcfoc2_t * | ctx | ) |
BLDC FOC 2 EEPROM access lock function.
This function locks the EEPROM access by writing the appropriate command.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
0 - Success, -1 - Error. | err_t bldcfoc2_eeprom_access_unlock | ( | bldcfoc2_t * | ctx | ) |
BLDC FOC 2 EEPROM access unlock function.
This function unlocks the EEPROM access by writing the appropriate command.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
0 - Success, -1 - Error. | err_t bldcfoc2_eeprom_erase | ( | bldcfoc2_t * | ctx, |
| uint8_t | addr ) |
BLDC FOC 2 EEPROM erase function.
This function erases the EEPROM content at the selected address.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
| [in] | addr | : EEPROM register address. |
0 - Success, -1 - Error. | err_t bldcfoc2_eeprom_read | ( | bldcfoc2_t * | ctx, |
| uint8_t | addr, | ||
| uint32_t * | data_out ) |
BLDC FOC 2 EEPROM read function.
This function reads a 24-bit value from the selected EEPROM register.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
| [in] | addr | : EEPROM register address. |
| [out] | data_out | : Pointer to memory where read data will be stored. |
0 - Success, -1 - Error. | err_t bldcfoc2_eeprom_set_config | ( | bldcfoc2_t * | ctx | ) |
BLDC FOC 2 EEPROM default config function.
This function sets the default EEPROM configuration for the motor F80 PRO KV1900, optimized for 11.2V 10A power supply and PWM input range 10-50% at 20kHz.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
0 - Success, -1 - Error. | err_t bldcfoc2_eeprom_write | ( | bldcfoc2_t * | ctx, |
| uint8_t | addr, | ||
| uint32_t | data_in ) |
BLDC FOC 2 EEPROM write function.
This function writes a 24-bit value to the selected EEPROM register.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
| [in] | addr | : EEPROM register address. |
| [in] | data_in | : Data to be written (24-bit). |
0 - Success, -1 - Error. | uint8_t bldcfoc2_get_fault_pin | ( | bldcfoc2_t * | ctx | ) |
BLDC FOC 2 get FAULT pin state function.
This function returns the logic state of the FAULT pin.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
| uint8_t bldcfoc2_get_fgo_pin | ( | bldcfoc2_t * | ctx | ) |
BLDC FOC 2 get FGO pin state function.
This function returns the logic state of the FGO (FG Out) pin.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
| err_t bldcfoc2_init | ( | bldcfoc2_t * | ctx, |
| bldcfoc2_cfg_t * | cfg ) |
BLDC FOC 2 initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
| [out] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
| [in] | cfg | : Click configuration structure. See bldcfoc2_cfg_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | void bldcfoc2_pull_brake | ( | bldcfoc2_t * | ctx | ) |
BLDC FOC 2 pull brake function.
This function pulls the brake by setting the RST pin to a low logic state.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
| err_t bldcfoc2_pwm_start | ( | bldcfoc2_t * | ctx | ) |
BLDC FOC 2 start PWM function.
This function starts the PWM output.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
0 - Success, -1 - Error. | err_t bldcfoc2_pwm_stop | ( | bldcfoc2_t * | ctx | ) |
BLDC FOC 2 stop PWM function.
This function stops the PWM output.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
0 - Success, -1 - Error. | err_t bldcfoc2_read_reg | ( | bldcfoc2_t * | ctx, |
| uint8_t | reg, | ||
| uint32_t * | data_out ) |
BLDC FOC 2 read register function.
This function reads a 24-bit data from the selected register.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [out] | data_out | : Output read data (24-bit). |
0 - Success, -1 - Error. | err_t bldcfoc2_read_regs | ( | bldcfoc2_t * | ctx, |
| uint8_t | reg, | ||
| uint32_t * | data_out, | ||
| uint8_t | len ) |
BLDC FOC 2 read multiple registers function.
This function reads multiple 24-bit values starting from the selected register.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
| [in] | reg | : Starting register address. |
| [out] | data_out | : Buffer to store read values. |
| [in] | len | : Number of registers to read. |
0 - Success, -1 - Error. | void bldcfoc2_release_brake | ( | bldcfoc2_t * | ctx | ) |
BLDC FOC 2 release brake function.
This function releases the brake by setting the RST pin to a high logic state.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
| void bldcfoc2_set_direction | ( | bldcfoc2_t * | ctx, |
| uint8_t | dir ) |
BLDC FOC 2 set direction function.
This function sets the motor rotation direction by setting the DIR pin logic state.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
| [in] | dir | : Direction logic level (0 or 1). |
| err_t bldcfoc2_set_duty_cycle | ( | bldcfoc2_t * | ctx, |
| float | duty_cycle ) |
BLDC FOC 2 set duty cycle function.
This function sets the PWM duty cycle used to control the motor speed.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
| [in] | duty_cycle | : PWM duty cycle (0.0 - 1.0). |
0 - Success, -1 - Error. | void bldcfoc2_switch_direction | ( | bldcfoc2_t * | ctx | ) |
BLDC FOC 2 switch direction function.
This function toggles the motor rotation direction by inverting the DIR pin state.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
| err_t bldcfoc2_write_reg | ( | bldcfoc2_t * | ctx, |
| uint8_t | reg, | ||
| uint32_t | data_in ) |
BLDC FOC 2 write register function.
This function writes a 24-bit data to the selected register.
| [in] | ctx | : Click context object. See bldcfoc2_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [in] | data_in | : Data to be written (24-bit). |
0 - Success, -1 - Error.